package com.xiangban.volunteer_platform.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiangban.volunteer_platform.dao.WorkTypeMapper;
import com.xiangban.volunteer_platform.entity.WorkType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/1/26 14:14
 */
@Service
public class WorkTypeService {

    @Autowired
    private WorkTypeMapper workTypeMapper;

    public void save(WorkType workType) {
        workTypeMapper.insert(workType);
    }


    public void del(WorkType workType) {
        workTypeMapper.deleteById(workType.getId());
    }

    public void update(WorkType workType) {

        workTypeMapper.updateById(workType);
    }

    public List<WorkType> getAll() {
       return workTypeMapper.selectList(new LambdaQueryWrapper<>());
    }

    public WorkType getWorkType(WorkType workType) {
       return workTypeMapper.selectById(workType.getId());

    }
}
